<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Empreinte Carbone:  Fichier source de empreinte_carbone.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Généré par Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Recherche');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Empreinte Carbone&#160;<span id="projectnumber">v1.0</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Page&#160;principale</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Recherche" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Liste&#160;des&#160;fichiers</span></a></li>
      <li><a href="globals.html"><span>Membres&#160;de&#160;fichier</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('empreinte__carbone_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">empreinte_carbone.cpp</div>  </div>
</div>
<div class="contents">
<a href="empreinte__carbone_8cpp.html">Aller à la documentation de ce fichier.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00038"></a>00038 <span class="comment">/*-- Bibliotheques utilisees en ordre alphabetique --*/</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 <span class="keyword">using namespace </span>std;
<a name="l00042"></a>00042 
<a name="l00044"></a>00044 <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(<span class="keywordtype">float</span>, <span class="keywordtype">float</span>);
<a name="l00045"></a>00045 
<a name="l00050"></a><a class="code" href="empreinte__carbone_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">00050</a> <span class="keywordtype">int</span> <a class="code" href="empreinte__carbone_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4" title="Programme principal qui se contente d&#39;apeller les fonctions pour le calcul en tonnes de la consommati...">main</a>()
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052     <span class="comment">// Declaration des fonctions utilisees dans le main (a partir du ch.3)</span>
<a name="l00053"></a>00053     <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#aced726bfa76026cdde9d4cae66b215db" title="Fonction de calcul de l&#39;emission de CO2 des transports.">calcul_e_transport</a>();
<a name="l00054"></a>00054     <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#a3d47f2f8f707cd4f94fc84789c1891e7" title="Fonction de calcul de l&#39;emission de CO2 d&#39;une habitation.">calcul_e_habitation</a>(<span class="keywordtype">int</span>);
<a name="l00055"></a>00055     <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#a305ff9f3b86dd0f500423305caa7865b" title="Fonction de calcul de l&#39;emission de CO2 de la nourriture.">calcul_e_nourriture</a>();
<a name="l00056"></a>00056     <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#afbd15df98aa047050e9dda8ecbb3b58e" title="Fonction de calcul de l&#39;emission de CO2 des dechets.">calcul_e_dechets</a>(<span class="keywordtype">int</span>);
<a name="l00057"></a>00057     <span class="comment">// Declaration des constantes</span>
<a name="l00058"></a>00058     <span class="keyword">const</span> <span class="keywordtype">int</span> LIVRE_PAR_TONNE = 2000;
<a name="l00059"></a>00059 
<a name="l00060"></a>00060     <span class="comment">// Declaration des variables locales</span>
<a name="l00061"></a>00061     <span class="keywordtype">int</span> nombre_personne;
<a name="l00062"></a>00062     <span class="keywordtype">float</span> emission_tonnes;
<a name="l00063"></a>00063     <span class="keywordtype">float</span> emission_transport, emission_habitation, emission_nourriture, emission_dechets;
<a name="l00064"></a>00064 
<a name="l00065"></a>00065     <span class="comment">// Corps de main : enonce executable</span>
<a name="l00066"></a>00066     cout &lt;&lt; <span class="stringliteral">&quot;Entrez le monbre de personne dans l&#39;habitation : &quot;</span>  &lt;&lt; endl;
<a name="l00067"></a>00067     cin &gt;&gt; nombre_personne;
<a name="l00068"></a>00068 
<a name="l00069"></a>00069     emission_transport = <a class="code" href="empreinte__carbone_8cpp.html#aced726bfa76026cdde9d4cae66b215db" title="Fonction de calcul de l&#39;emission de CO2 des transports.">calcul_e_transport</a>();
<a name="l00070"></a>00070 
<a name="l00071"></a>00071     emission_habitation = <a class="code" href="empreinte__carbone_8cpp.html#a3d47f2f8f707cd4f94fc84789c1891e7" title="Fonction de calcul de l&#39;emission de CO2 d&#39;une habitation.">calcul_e_habitation</a>(nombre_personne);
<a name="l00072"></a>00072     emission_nourriture = <a class="code" href="empreinte__carbone_8cpp.html#a305ff9f3b86dd0f500423305caa7865b" title="Fonction de calcul de l&#39;emission de CO2 de la nourriture.">calcul_e_nourriture</a>();
<a name="l00073"></a>00073     emission_dechets = <a class="code" href="empreinte__carbone_8cpp.html#afbd15df98aa047050e9dda8ecbb3b58e" title="Fonction de calcul de l&#39;emission de CO2 des dechets.">calcul_e_dechets</a>(nombre_personne);
<a name="l00074"></a>00074 
<a name="l00075"></a>00075     emission_tonnes = (emission_transport + emission_habitation +
<a name="l00076"></a>00076                        emission_dechets + emission_nourriture)
<a name="l00077"></a>00077                       / LIVRE_PAR_TONNE;
<a name="l00078"></a>00078 
<a name="l00079"></a>00079     cout &lt;&lt; <span class="stringliteral">&quot;Votre consommation en tonnes : &quot;</span> &lt;&lt; emission_tonnes
<a name="l00080"></a>00080          &lt;&lt; endl;
<a name="l00081"></a>00081     <span class="comment">// retour</span>
<a name="l00082"></a>00082     <span class="keywordflow">return</span> 0;
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084 
<a name="l00085"></a>00085 
<a name="l00102"></a><a class="code" href="empreinte__carbone_8cpp.html#aced726bfa76026cdde9d4cae66b215db">00102</a> <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#aced726bfa76026cdde9d4cae66b215db" title="Fonction de calcul de l&#39;emission de CO2 des transports.">calcul_e_transport</a>()
<a name="l00103"></a>00103 {
<a name="l00104"></a>00104     <span class="comment">// Declaration des fonctions utilisees dans la fonction</span>
<a name="l00105"></a>00105     <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#ae1a5d05b10db3794069f36348a4e173f" title="Fonction de calcul de l&#39;emission de CO2 pour la voiture.">calcul_e_voiture</a>(<span class="keywordtype">float</span>, <span class="keywordtype">float</span>);
<a name="l00106"></a>00106 
<a name="l00107"></a>00107     <span class="comment">// Declaration des constantes</span>
<a name="l00109"></a>00109 <span class="comment"></span>    <span class="keyword">const</span> <span class="keywordtype">float</span> CO2_AVION   = .25;
<a name="l00111"></a>00111     <span class="keyword">const</span> <span class="keywordtype">float</span> CO2_AUTOBUS = .105;
<a name="l00113"></a>00113     <span class="keyword">const</span> <span class="keywordtype">float</span> CO2_TRAIN   = .126;
<a name="l00114"></a>00114 
<a name="l00115"></a>00115     <span class="comment">// Declaration des variables locales</span>
<a name="l00116"></a>00116     <span class="keywordtype">float</span> emission_totale = 0;
<a name="l00117"></a>00117     <span class="keywordtype">float</span> distance_avion, distance_train, distance_autobus, distance_parcourue;
<a name="l00118"></a>00118     <span class="keywordtype">float</span> taux_de_consommation;
<a name="l00119"></a>00119 
<a name="l00120"></a>00120     <span class="comment">// Corps de la fonction</span>
<a name="l00121"></a>00121     cout &lt;&lt; <span class="stringliteral">&quot;Taux de consommation d&#39;essence (L/100km): &quot;</span>  &lt;&lt; endl;
<a name="l00122"></a>00122     cin &gt;&gt; taux_de_consommation;
<a name="l00123"></a>00123 
<a name="l00124"></a>00124     cout &lt;&lt; <span class="stringliteral">&quot;Distance parcourue en voiuture (km): &quot;</span>  &lt;&lt; endl;
<a name="l00125"></a>00125     cin &gt;&gt; distance_parcourue;
<a name="l00126"></a>00126 
<a name="l00127"></a>00127     cout &lt;&lt; <span class="stringliteral">&quot;Distance parcourue en avion (km) : &quot;</span>  &lt;&lt; endl;
<a name="l00128"></a>00128     cin &gt;&gt; distance_avion;
<a name="l00129"></a>00129 
<a name="l00130"></a>00130     cout &lt;&lt; <span class="stringliteral">&quot;Distance parcourue en train (km) : &quot;</span>  &lt;&lt; endl;
<a name="l00131"></a>00131     cin &gt;&gt; distance_train;
<a name="l00132"></a>00132 
<a name="l00133"></a>00133     cout &lt;&lt; <span class="stringliteral">&quot;Distance parcourue en autobus (km) : &quot;</span>  &lt;&lt; endl;
<a name="l00134"></a>00134     cin &gt;&gt; distance_autobus;
<a name="l00135"></a>00135 
<a name="l00136"></a>00136     emission_totale = <a class="code" href="empreinte__carbone_8cpp.html#ae1a5d05b10db3794069f36348a4e173f" title="Fonction de calcul de l&#39;emission de CO2 pour la voiture.">calcul_e_voiture</a>(taux_de_consommation, distance_parcourue) +
<a name="l00137"></a>00137                       <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(distance_avion, CO2_AVION)+
<a name="l00138"></a>00138                       <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(distance_autobus, CO2_AUTOBUS)+
<a name="l00139"></a>00139                       <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(distance_train, CO2_TRAIN);
<a name="l00140"></a>00140 
<a name="l00141"></a>00141 
<a name="l00142"></a>00142     <span class="comment">// ne pas oublier le retour</span>
<a name="l00143"></a>00143     <span class="keywordflow">return</span> emission_totale;
<a name="l00144"></a>00144 }
<a name="l00145"></a>00145 
<a name="l00160"></a><a class="code" href="empreinte__carbone_8cpp.html#a3d47f2f8f707cd4f94fc84789c1891e7">00160</a> <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#a3d47f2f8f707cd4f94fc84789c1891e7" title="Fonction de calcul de l&#39;emission de CO2 d&#39;une habitation.">calcul_e_habitation</a>(<span class="keywordtype">int</span> nb_habitant)
<a name="l00161"></a>00161 {
<a name="l00162"></a>00162     <span class="comment">// Declaration des constantes</span>
<a name="l00164"></a>00164 <span class="comment"></span>    <span class="keyword">const</span> <span class="keywordtype">float</span> CO2_KWh         = 2.3;
<a name="l00166"></a>00166     <span class="keyword">const</span> <span class="keywordtype">float</span> CO2_L_GAZ       = .004;
<a name="l00168"></a>00168     <span class="keyword">const</span> <span class="keywordtype">int</span>   NB_MOIS_ANS     = 12;
<a name="l00169"></a>00169 
<a name="l00170"></a>00170     <span class="comment">// Declaration des variables locales</span>
<a name="l00171"></a>00171     <span class="keywordtype">int</span> KWh_mois, volume_gaz;
<a name="l00172"></a>00172     <span class="keywordtype">float</span> emission_annuelle, emission_elec, emission_gaz;
<a name="l00173"></a>00173 
<a name="l00174"></a>00174     <span class="comment">// Corps de la fonction</span>
<a name="l00175"></a>00175     cout &lt;&lt; <span class="stringliteral">&quot;Nombre de KWh par mois : &quot;</span>  &lt;&lt; endl;
<a name="l00176"></a>00176     cin &gt;&gt; KWh_mois;
<a name="l00177"></a>00177 
<a name="l00178"></a>00178     cout &lt;&lt; <span class="stringliteral">&quot;Volume de gaz par mois : &quot;</span>  &lt;&lt; endl;
<a name="l00179"></a>00179     cin &gt;&gt; volume_gaz;
<a name="l00180"></a>00180 
<a name="l00181"></a>00181     emission_elec = <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(KWh_mois, CO2_KWh);
<a name="l00182"></a>00182     emission_gaz = <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(volume_gaz, CO2_L_GAZ);
<a name="l00183"></a>00183 
<a name="l00184"></a>00184     emission_annuelle = (emission_elec + emission_gaz) * NB_MOIS_ANS;
<a name="l00185"></a>00185     emission_annuelle /= nb_habitant;
<a name="l00186"></a>00186     <span class="comment">// ne pas oublier le retour</span>
<a name="l00187"></a>00187     <span class="keywordflow">return</span> emission_annuelle ;
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189 
<a name="l00203"></a><a class="code" href="empreinte__carbone_8cpp.html#a305ff9f3b86dd0f500423305caa7865b">00203</a> <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#a305ff9f3b86dd0f500423305caa7865b" title="Fonction de calcul de l&#39;emission de CO2 de la nourriture.">calcul_e_nourriture</a>()
<a name="l00204"></a>00204 {
<a name="l00205"></a>00205     <span class="comment">// Declaration des constantes</span>
<a name="l00207"></a>00207 <span class="comment"></span>    <span class="keyword">const</span> <span class="keywordtype">int</span> CO2_NOURRITURE_IMPORT     = 3000;
<a name="l00209"></a>00209     <span class="keyword">const</span> <span class="keywordtype">int</span> CO2_NOURRITURE_LOCALE     = 1500;
<a name="l00210"></a>00210 
<a name="l00211"></a>00211     <span class="comment">// Declaration des variables locales</span>
<a name="l00212"></a>00212     <span class="keywordtype">float</span> nourriture_import_jours, nourriture_locale_jours;
<a name="l00213"></a>00213     <span class="keywordtype">float</span> emission_totale;
<a name="l00214"></a>00214 
<a name="l00215"></a>00215     <span class="comment">// Corps de la fonction</span>
<a name="l00216"></a>00216     cout &lt;&lt; <span class="stringliteral">&quot;Quantite de nourriture importee par jours (lbs) : &quot;</span> &lt;&lt; endl;
<a name="l00217"></a>00217     cin &gt;&gt; nourriture_import_jours;
<a name="l00218"></a>00218 
<a name="l00219"></a>00219     cout &lt;&lt; <span class="stringliteral">&quot;Quantite de nourriture locale par jours (lbs) : &quot;</span> &lt;&lt; endl;
<a name="l00220"></a>00220     cin &gt;&gt; nourriture_locale_jours;
<a name="l00221"></a>00221 
<a name="l00222"></a>00222     emission_totale = <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(nourriture_import_jours, CO2_NOURRITURE_IMPORT)
<a name="l00223"></a>00223                       + <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(nourriture_locale_jours, CO2_NOURRITURE_LOCALE);
<a name="l00224"></a>00224 
<a name="l00225"></a>00225     <span class="comment">// ne pas oublier le retour</span>
<a name="l00226"></a>00226     <span class="keywordflow">return</span> emission_totale;
<a name="l00227"></a>00227 }
<a name="l00228"></a>00228 
<a name="l00229"></a>00229 
<a name="l00244"></a><a class="code" href="empreinte__carbone_8cpp.html#afbd15df98aa047050e9dda8ecbb3b58e">00244</a> <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#afbd15df98aa047050e9dda8ecbb3b58e" title="Fonction de calcul de l&#39;emission de CO2 des dechets.">calcul_e_dechets</a>(<span class="keywordtype">int</span> nb_habitant)
<a name="l00245"></a>00245 {
<a name="l00246"></a>00246     <span class="comment">// Declaration des constantes</span>
<a name="l00248"></a>00248 <span class="comment"></span>    <span class="keyword">const</span> <span class="keywordtype">float</span> EMISSION_RECYCLE        = .2;
<a name="l00250"></a>00250     <span class="keyword">const</span> <span class="keywordtype">float</span> JOURS_ANS               = 365;
<a name="l00251"></a>00251 
<a name="l00252"></a>00252     <span class="comment">// Declaration des variables locales</span>
<a name="l00253"></a>00253     <span class="keywordtype">float</span> quantite_dechets, pourcentage_recycle;
<a name="l00254"></a>00254     <span class="keywordtype">float</span> quantite_recycle, quantite_non_recycle, emission_dechets_recycles;
<a name="l00255"></a>00255     <span class="keywordtype">float</span> dechets_par_personne, emission_dechets;
<a name="l00256"></a>00256 
<a name="l00257"></a>00257     <span class="comment">// Corps de la fonction</span>
<a name="l00258"></a>00258     cout &lt;&lt; <span class="stringliteral">&quot;Quantite de dechets (lbs): &quot;</span>  &lt;&lt; endl;
<a name="l00259"></a>00259     cin &gt;&gt; quantite_dechets;
<a name="l00260"></a>00260 
<a name="l00261"></a>00261     cout &lt;&lt; <span class="stringliteral">&quot;Pourcentage recycle (lbs): &quot;</span>  &lt;&lt; endl;
<a name="l00262"></a>00262     cin &gt;&gt; pourcentage_recycle;
<a name="l00263"></a>00263 
<a name="l00264"></a>00264     quantite_recycle = quantite_dechets * (pourcentage_recycle / 100);
<a name="l00265"></a>00265     quantite_non_recycle = quantite_dechets - quantite_recycle;
<a name="l00266"></a>00266 
<a name="l00267"></a>00267     emission_dechets_recycles = <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(quantite_recycle, EMISSION_RECYCLE);
<a name="l00268"></a>00268 
<a name="l00269"></a>00269     emission_dechets = (quantite_non_recycle + emission_dechets_recycles) * JOURS_ANS;
<a name="l00270"></a>00270     dechets_par_personne = emission_dechets / nb_habitant;
<a name="l00271"></a>00271 
<a name="l00272"></a>00272     <span class="comment">// ne pas oublier le retour</span>
<a name="l00273"></a>00273     <span class="keywordflow">return</span> dechets_par_personne;
<a name="l00274"></a>00274 }
<a name="l00275"></a>00275 
<a name="l00276"></a>00276 
<a name="l00289"></a><a class="code" href="empreinte__carbone_8cpp.html#ae1a5d05b10db3794069f36348a4e173f">00289</a> <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#ae1a5d05b10db3794069f36348a4e173f" title="Fonction de calcul de l&#39;emission de CO2 pour la voiture.">calcul_e_voiture</a>(<span class="keywordtype">float</span> taux_consommation, <span class="keywordtype">float</span> distance_parcourue)
<a name="l00290"></a>00290 {
<a name="l00291"></a>00291     <span class="comment">// Declaration des constantes</span>
<a name="l00293"></a>00293 <span class="comment"></span>    <span class="keyword">const</span> <span class="keywordtype">float</span> CO2_L_ESSENCE           = 5.2;
<a name="l00295"></a>00295     <span class="keyword">const</span> <span class="keywordtype">float</span> CO2_VOITURE             = 2000;
<a name="l00296"></a>00296 
<a name="l00297"></a>00297     <span class="comment">// Declaration des variables locales</span>
<a name="l00298"></a>00298     <span class="keywordtype">float</span> consommation_annuelle, emission_voiture, emission_essence;
<a name="l00299"></a>00299 
<a name="l00300"></a>00300     <span class="comment">// Corps de la fonction</span>
<a name="l00301"></a>00301 
<a name="l00302"></a>00302     consommation_annuelle = (taux_consommation / 100) * distance_parcourue;
<a name="l00303"></a>00303     emission_essence = <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(consommation_annuelle, CO2_L_ESSENCE);
<a name="l00304"></a>00304     emission_voiture = emission_essence + CO2_VOITURE;
<a name="l00305"></a>00305 
<a name="l00306"></a>00306     <span class="comment">// ne pas oublier le retour</span>
<a name="l00307"></a>00307     <span class="keywordflow">return</span> emission_voiture;
<a name="l00308"></a>00308 }
<a name="l00309"></a>00309 
<a name="l00310"></a>00310 
<a name="l00323"></a><a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c">00323</a> <span class="keywordtype">float</span> <a class="code" href="empreinte__carbone_8cpp.html#ad8ab5bfe1a923a8d305d9b7a29f99d0c" title="fonction emission par unite utilise dans plusieurs fonctions.">emissions_par_unite</a>(<span class="keywordtype">float</span> unite, <span class="keywordtype">float</span> taux)
<a name="l00324"></a>00324 {
<a name="l00325"></a>00325     <span class="comment">// Declaration des variables locales</span>
<a name="l00326"></a>00326     <span class="keywordtype">float</span> emission_CO2;
<a name="l00327"></a>00327 
<a name="l00328"></a>00328     <span class="comment">// Corps de la fonction</span>
<a name="l00329"></a>00329     emission_CO2 = taux * unite;
<a name="l00330"></a>00330     <span class="comment">// ne pas oublier le retour</span>
<a name="l00331"></a>00331     <span class="keywordflow">return</span> emission_CO2;
<a name="l00332"></a>00332 }
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="empreinte__carbone_8cpp.html">empreinte_carbone.cpp</a>      </li>
      <li class="footer">Généré le Tue Feb 7 2012 14:41:43 pour Empreinte Carbone par&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Tout</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Fichiers</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Fonctions</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


</body>
</html>
